package click;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

@SuppressWarnings("serial")
public class MMess extends JFrame{
	JLabel lbl = new JLabel();
	JLabel lbl2 = new JLabel();
	
	public MMess(){
		initialize("Erro", null);
	}

	public MMess(String str){
		initialize(str, null);
	}
	
	public MMess(String str, String str2){
		initialize(str, str2);
	}
	

	private void initialize(String str, String str2) {
		if (this.getHeight() == 0){
			this.setSize(250,150);
			this.setLocationRelativeTo(null);
			setTitle("Erro");
			setResizable(false);
			//setDefaultCloseOperation(MMess.EXIT_ON_CLOSE);
		}
		this.setVisible(true);
		setText(str, str2);
	}

	public void setText(String str){
		setText(str, null);
	}
	public void setText(String str, String str2){
		getContentPane().setLayout(null);

		lbl.setText(str);
		lbl.setHorizontalAlignment(SwingConstants.CENTER);
		lbl.setBounds(0, 25, 234, 14);
		getContentPane().add(lbl);
		
	    lbl2.setText(str2);
		lbl2.setHorizontalAlignment(SwingConstants.CENTER);
		lbl2.setBounds(0, 40, 234, 14);
		getContentPane().add(lbl2);
		JButton btnOk = new JButton("OK");
		btnOk.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dispose();
			}
		});
		btnOk.setBounds(86, 65, 65, 23);
		getContentPane().add(btnOk);
		
		
	}
}
